﻿@{
    ViewBag.Title = "Category";
}
@using MvcContrib
@using MvcContrib.UI.Grid
@model IEnumerable<BO.Category>
<script src="~/Scripts/ims.js" type="text/javascript"></script>
<h3>
    Create Category</h3>
<table>
    <tr>
        <td>
            Name:
        </td>
        <td>
            <input id="txtName" type="text" />
        </td>
    </tr>
    <tr>
        <td>
            Description:
        </td>
        <td>
            <input id="txtDescription" type="text" />
        </td>
    </tr>
    <tr>
        <td>
            <input id="btnSave" type="button" value="Save" onclick="doCategorySave()" />
        </td>
    </tr>
</table>
<br />
<h2>
    List of Categories:</h2>
@{
    Html.Grid(Model).Columns(
            column =>
            {
                column.For(c => c.CategoryId).Attributes(x => new Hash(style => "width:20px")).Named("Id");
                column.For(c => c.Name).Attributes(x => new Hash(style => "width:80px"));
                column.For(c => c.Description).Attributes(x => new Hash(style => "width:120px"));
                column.Custom(@<div>
                    <a href="" onclick="onCategoryEdit(@item.CategoryId )">edit</a></div>).Named("");
                column.Custom(@<div>
                    <a href="" onclick="onCategoryDelete(@item.CategoryId)">delete</a></div>).Named("");
            }

        ).Render();
}